import { useTable, LIST_TYPE } from '@crud/index';
import { getSkuWindowList } from '@/api/crm-kgj/sku';
// import MockService from '@/services/mock';
// 查询

// 表格
export const useTableList = (options: any = {}) => {
  const columns: any = [
    { label: '抖音号', prop: 'cover', minWidth: 280, render: 'cover', fixed: 'left' },
    { label: '粉丝数', prop: 'fans_count', minWidth: 120, render: (s:any) => s.row.type, align: 'center' },
    { label: '添加时间', prop: 'add_time', minWidth: 200, type: 'dateTime', align: 'center' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.AGENCY,
    params: {
      // colonelId: undefined
    },
    pages: {
      pageSize: 5
    },
    columns: columns,
    // usePagination: false,
    getList: ({ params = {}, data = {} }: { params: any; data: any }) => {
      // const mockApi = () => {
      //   return new Promise((resolve) => {
      //     setTimeout(() => {
      //       resolve(MockService.mock({
      //         id: '@index',
      //         cover: '@picture',
      //         url: '@url',
      //         title: '@name:product',
      //         colonel_name: '@name',
      //         fans_count: '@integer',
      //         add_time: '@timestamp'
      //       }, params));
      //     }, 500);
      //   });
      // };
      // return mockApi();
      return getSkuWindowList(data.productId, params);
    }
  });
};
